Portable Spa Monitoring and Control Circuitry

ABSTRACT

Control circuitry for controlling a spa water heater, wherein a microcontroller is configured to detect zero crossings of an A.C. line voltage from a voltage sense signal, to cause closing of a first heater relay and a second heater relay, to detect the time at which heater current is initially sensed by a current sensor after the initial closing of the second heater relay, to measure a time delay between the time that the second heater relay is closed and the time at which heater current is initially sensed, and to adjust the time at which a second closing of the second heater relay occurs such that zero crossings of the heater current occur at the same time as zero crossings of the voltage waveform. The control circuitry further includes a voltage sense circuit comprising a first diode connected in series with a current limiting resistance connected in series with a Zener diode, which is in turn connected in series with an optical coupler LED.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a divisional of and claims priority to U.S. Utilitypatent application Ser. No. 13/527,014, entitled “Portable SpaMonitoring and Control Circuitry,” filed on Jun. 19, 2012, the contentsof which is incorporated herein by reference in its entirety.

BACKGROUND OF THE INVENTION

1. Field of Invention

The subject disclosure relates to spa monitoring and control circuitryfor portable spas, tubs and the like and more particularly to voltagesensing circuitry for determining the magnitude, frequency and zerocross times of an input signal, and to circuitry for timing the openingand closing of heater relays to occur at or near zero cross points.

2. Related Art

Portable spas have become quite popular as a result of their ease of useand multiplicity of features such as varied jet and seatingconfigurations. One area where the inventor has recognized thatimprovement would be desirable concerns the manner of efficientlymaintaining and controlling various spa equipment operations, andparticularly the operation of the spa water heater and associatedrelays.

SUMMARY

The following is a summary description of illustrative embodiments ofthe invention. It is provided as a preface to assist those skilled inthe art to more rapidly assimilate the detailed design discussion whichensues and is not intended in any way to limit the scope of the claimswhich are appended hereto in order to particularly point out theinvention.

According to an illustrative embodiment, control circuitry forcontrolling a spa water heater comprises first and second relayscloseable to supply current to the spa water heater together with acurrent sensor for generating a current sense signal, a voltage sensorcircuit for generating a voltage sense signal, and a microcontrollersupplied with the current sense and voltage sense signals. Themicrocontroller is configured to detect zero crossings from the voltagesense signal and to cause closing of the first heater relay and thesecond heater relay. The microcontroller is further configured to detectthe time at which heater current is initially sensed by the currentsensor after the initial closing of the second heater relay, and tomeasure a time delay between the time the second heater relay is closedand the time at which heater current is initially sensed. Themicrocontroller thereafter employs the measured time delay to adjust thetime at which a second closing of the second heater relay occurs suchthat the closure of the relay contacts is synchronous with a zerocrossing of the voltage waveform.

In an alternate embodiment, the same circuitry configuration may also beemployed to control the supply of current to a spa pump motor.

In one embodiment, the voltage sensor circuit may comprise a first diodeconnected in series with a current limiting resistance connected inseries with a Zener diode, which is in turn connected in series with anoptical coupler LED. In this illustrative embodiment, an A.C. voltage tobe sensed is coupled across one terminal of the first diode and oneterminal of the optical coupler LED. The optical coupler LED comprisespart of an optical coupler circuit whose output provides a voltage sensesignal comprising a pulse train whose pulse width is proportional to theA. C. input voltage.

DETAILED DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic diagram of one embodiment of a spa system;

FIG. 2 is an electrical circuit diagram of an illustrative embodiment ofspa monitoring and control circuitry;

FIG. 3 is a wave form diagram illustrating operation of the circuit ofFIG. 2 during a first heater “turn on” operation;

FIG. 4 is a wave form diagram illustrating a second heater “turn on”operation;

FIG. 5 is a wave form diagram illustrating a heater “turn-off”operation;

FIG. 6 is an electrical circuit diagram of an illustrative embodiment ofa voltage sensor circuit;

FIG. 7 is a graph illustrating the pulse width to voltage relationshipfor the circuit of FIG. 6; and

FIG. 8 illustrates an edge detect operation as performed by theillustrative embodiment.

DETAILED DESCRIPTION

FIG. 1 illustrates one embodiment of a spa system 11. In this system 11,water is circulated through a water circulation path 12. In the watercirculation path 12 are a spa tub 13, a circulation pump 15, a resistiveheater 23, a spa controller 29, a regulating temperature thermistor 17,a high-limit thermistor 19, and a pressure sensor 18 to sense properwater flow. In one embodiment, the spa controller 29 interfaces with acontrol head 31, which includes a user interface 33. The spa controller29 may include one or more microprocessors or microcontrollers, as wellas fault detection hardware, which may receive inputs from the highlimit temperature sensor 19, the temperature regulation sensor 17, andthe pressure regulation sensor 18. In particular, the value sensed bythe thermistor 17 may be used by the microcontroller 29 to regulatewater temperature, and the value measured by thermistor 19 may be usedto shut off heater operation if the water temperature exceeds, forexample, 120° F. The controller 29 may further be configured to switch“on” or “off” the spa water heater 23, one or more jet pumps, thecirculation pump 15, an ozone generator, an audio system and/or spalights and external lighting.

Spa heaters such as the resistive heater 23 of FIG. 1 typically requiresignificant power and their operation can shorten the life of the relaysthat switch the heater power as a result of relay contact arcing onturn-on and turn-off. According to an illustrative embodiment, openingand closing of a switching relay is timed to occur synchronously withthe zero voltage crossing of the AC power line, thus minimizing arcingand wear. The illustrative embodiment senses the actual current to theheater 23, leaving no doubt when switching occurred and improves thesystem by providing early fault detection. The illustrative embodimentalso provides additional protection against welded-closed relay contactsand the resulting fire hazard from continuous heater operation. Theintegrity of both relays is checked before proceeding, at a time whenrecovery and hazard prevention is still possible.

“Zero-cross switching” means that the relay contacts open or close at atime selected to cause the sine wave heater current to cross at or nearzero near the time that the AC sine wave voltage changes its electricalpolarity, resulting in minimal or no contact arcing and wear. Theopposite of zero-cross switching is switching at peak voltage of thesine wave, which can result in significant arcing and contact wear, aswell as increased potential for contact welding. In exemplaryembodiments, the AC voltage frequency is 60 Hz and its RMS magnitude is120 or 240 volts.

A zero-cross switching circuit 111 according to an illustrativeembodiment is shown in FIG. 2 and includes:

a) A current sense transducer 24 capable of sensing the current waveformof current flowing to a heater 23. The transducer 24 may be, forexample, a Hall Effect transducer or sensor;

b) A zero cross detector circuit 27 to sense the timing of the supplyvoltage; and

c) Two relays A, B to switch each leg 28, 30 of the line voltage to theheater element 23, called “Relay A” and “Relay B”.

In the illustrative circuit embodiment of FIG. 2, the diode D2 isconnected directly to the full line voltage V_(LINE), typically in therange of 100 to 250 volts AC (50 or 60 hz).

Relay “Turn On” Operation

The operation of the illustrative embodiment is as follows: a signal S₁from the controller 29 turns on the relay A without any zero crossingadjustment, while leaving relay B off. The controller 29 then checks tomake sure that there is no heater current sensed by the current sensecircuit 24. If no heater current is sensed, the control flow proceeds tothe next step. If heater current is sensed, the controller 29 determinesthat the relay B is welded closed and that the circuit has failed,requiring appropriate corrective action to prevent creation of a safetyhazard from uncontrolled heating if relay A is also welded closed. If noheater current is sensed, the relay B is then turned on by controlsignal S₂ after, for example, a 500 millisecond delay.

Assuming no heater current is sensed when the relay A is closed bysignal S₁, the zero voltage crossing input line 21 from the zero crossdetector 27 is monitored to sense the timing of the zero voltagecrossings (positive or negative). The A.C. signal V_(LINE) is applied tothe zero cross detector 27 prior to closing the relay A, such that it isalready detecting zero crossings prior to closing the relay A. Thecurrent sensor 24 is also monitored to determine when current startsflowing to the heater 23, representative of how long it took the relay Bto close relative to when its coil 32 was energized (turned on) byapplying a signal S₂. A predetermined delay time is then calculated sothat the relay B will close at or near the zero voltage crossing thenext time that the heater 23 is turned on.

Thus, the relay actuation time is tuned by:

-   -   Turning on the relay B with zero delay adjustment from zero        cross the first time that the heater 23 is turned on.    -   Measuring the increase in current and relative timing from the        current sensor 24 to determine an appropriate delay from the        voltage zero cross to set the relay actuation time for the next        time that the heater 23 is turned on.

The delay time calculation is illustrated graphically in FIG. 3 wherethe relay B coil voltage, the control signal S₂ and the heater currentare respectively graphed with respect to time on time lines 35, 37, 39.As illustrated, the signal S₂ is supplied to Relay B at time t₀, causingheater current to be sensed later at time t₁. The turn on delay betweenthe application of the control signal S₂ and the generation of heatercurrent is “T_(D)”. This time interval “T_(D)” is detected and stored bythe controller 29.

FIG. 4 illustrates circuit operation the next time that the heater 23 isturned on. Based on the input from the voltage sensing circuit 27, themicrocontroller 29 “knows” that a zero crossing of the voltage waveformwill occur at time t₋₂. The microcontroller 29 then waits until time t₋₁to apply the control signal S₂ to the coil 32 of the relay B. The timeinterval T_(E) between the zero crossing at t₋₂ and the generation ofthe control signal S₂ at time t₁ is equal to a half period of the sinewave (0.5 divided by the line frequency wf, e.g. 50 or 60 Hz) minus thedelay time T_(D) or:

$\frac{.5}{wf} - T_{D}$

As illustrated in FIG. 4, generation of the control signal S₂ at time t₁results in the relay B contacts closing and the heater current beginningto flow at a point in time t₀ which aligns with a zero crossing of thevoltage waveform.

The predetermined delay time T_(D) is subsequently adjusted each timethe relay B is turned on, resulting in the delay time tracking relaywear over the relay's lifespan. Example Calculation: S2 turn On Delayrelative to Zero Voltage Crossing=8.333ms−Sensed Current Turn OnRelative to Last Zero Voltage Crossing.

Depending on the relay response time, calculations may also be adjustedto accommodate T_(d) turn-on times of greater than ½ cycle of the ACline voltage, i.e., straddling more than one AC half-cycle.

Relay “Turn Off” Operation

With respect to the heater turn-off sequence, the timing for zerovoltage crossings is again determined. Since turn off can produceextended arcing and continuation of the heater current for severalmilliseconds after the actual contact opening, the algorithm graduallyreduces the delay until near zero current is seen at a point about 2 to3 milliseconds after a zero cross time.

With the heater on and a request to turn off, a first zero cross isdetermined using the Vsense input. A delay timer is then started using apre-determined delay from a previous cycle, or initially a time valueset to slightly shorter than the sample time. At the same moment (as ofthe first zero cross time), a fixed-time sample timer is started. Asdescribed above, this time is set to sample the current about 2-3milliseconds after a subsequent zero crossing, and should be set longerthan any anticipated relay turn off time. Relay A is turned off when thedelay timer times out, and current is sampled when the sample timertimes out. The delay time is then reduced if the current at the samplepoint is much greater than zero amps, indicating that the relay haseither not opened at all, or that arcing is occurring. This process isrepeated for each subsequent turn off cycle until the delay has beenreduced to the point where the current at the sample time is near zero.

In illustrative embodiments, “zero” current is typically not “absolute”zero. For example, in some embodiments with heaters that range from16-23 amps, a ±3 amps threshold may be detected or treated as “zero.” Invarious embodiments, switching within 1 to 2 milliseconds of a zerocrossing will be effective to satisfactorily suppress contact arcing andcontact wear.

FIG. 5 further illustrates operation of one embodiment of a relayturn-off mechanism. After detection of a zero crossing at time t₁, arelay delay timer and a sample timer are started. When the relay delaytimer times out at time t₄, the relay coil is de-energized. When thesample timer times out at time t₃, the heater current is sampled. Thedelay is reduced slightly for each turn off cycle until there is nearzero current at the sample time t₃, meaning that the contacts actuallyopened at time t₂ and because it is at zero crossing, noarc-continuation current is seen at the sample time. After turning offthe relay A, a check is made to ensure that the heater current went tozero. If no heater current is sensed, the controller 29 proceeds to turnoff relay B, no errors. If heater current is sensed, this indicates thatrelay A is welded closed and the circuit has failed, requiring anappropriate corrective action to prevent creation of a safety hazardfrom uncontrolled heating if relay B also is welded closed. Once therelay B is turned off, the heater 23 is fully off.

An illustrative embodiment of a spa equipment control system employsboth current sensors and voltage-to-pulse-width circuits for measuringvarious parameters. With these parameters, the power consumption of thespa can be computed and logged for reports to the owner or servicetechnician. In addition, operation can be restricted if the voltage istoo low, and the service technician can be alerted if currents suddenlyshift on a particular spa device (jet pump, heater, music system, etc.).

In one embodiment, a spa is supplied from up to three high voltagecircuits. To measure voltages on these circuits, the voltage-to-pulsewidth circuit 121 shown in FIG. 6 is used in conjunction with softwareto compute the line voltages in the system. FIG. 6 illustrates thefollowing components wired in series and connected across the voltagesource to be measured: a half-wave diode D₅, a current limitingresistance R₁₆, a zener diode D₄, and an optical coupler LED D₆ at theinput side of an optical coupler IC A₂. In certain embodiments, thecurrent limiting resistance R₁₆ may comprise one or more discreteresistors, for example, two 10K ohm resistors.

With respect to the operation of the illustrative embodiment of FIG. 6,the diode D₅ causes voltage information to be provided only for everyother half-cycle of the input AC voltage waveform V₁ (positive ornegative only). Since the line voltage is a sine wave, the zener diodeD₄ will not conduct current until its threshold is reached. Once itsthreshold is reached, the current starts flowing through the opticalcoupler LED D₆, resulting in the turn-on of the optical isolator outputtransistor Q₁. Once the line voltage sine wave again descends below thezener threshold, the current stops and the output transistor Q₁ of theoptical isolator A₂ turns off

As a result of this operation, the output V_(sense) of the circuit 121is a pulse train, whose pulse width is proportional to the line voltageV₁. This pulse train is timed by the microcontroller 29. Themicrocontroller software can then determine the following parameters:

a) Voltage, by translating the pulse width to a voltage based on eithera formula or a lookup table with intermediary computations of values forpoints between table entries. As illustrated in FIG. 7, the pulsewidth-to-voltage relationship is not linear.

b) Line frequency—The period of the pulse train represents thereciprocal of the line frequency.

c) Zero cross time—The zero cross time event can be computed bydetermining the time of occurrence of the exact middle of a pulse, thenadding or subtracting 25% of the period. This computed time is the timeof zero crossing and is used in the heater relay zero cross computationsdescribed in connection with the circuit of FIG. 2. To compute the timeoccurrence of zero voltage cross, a free running timer is used. Thesystem registers the timer value when each edge of the pulse occurs.Then the timer value at the midpoint of the pulse is computed. From thatcenter value, 25% of the period time value is added or subtracted fromthe center time value to establish the timer value for a zero crossing.

d) Enhancing Accuracy—The accuracy of the measurements is enhanced ifthe zener voltage is close to the range of input voltages. Toaccommodate a wide range of voltages (e.g., 90 to 260 VAC), two separatecircuits 121 may be used, one optimized for a lower range and a secondoptimized for a higher range of voltages. The microcontroller 29compares the two measurements and uses the measurement that is optimizedfor the selected voltage range, resulting in enhanced accuracy.

In one embodiment of the zero cross detect circuit, e.g. of FIG. 2, themicrocontroller 29 uses an edge sensitive capture input, which is partof the microcontroller hardware on the microcontroller chip itself. Themicrocontroller's software first sets the capture input to sense apositive transition of the V_(sense) pulse train independent ofsoftware, and the next positive signal edge of the pulse train causesthe value of a free-running hardware timer to be transferred at themoment of the edge to a latch. This edge also causes an interrupt tovector the microcontroller software to a routine that reads the latchvalue and re-programs the edge sense to sense the negative edge of thepulse train. The same process occurs when the negative edge occurs. So,the microcontroller software ends up producing a string of positive andnegative edge time values for use in making the calculations describedfor detecting zero crossings relative to the free-running timer.

The zero cross logic is a continuous process, occurring on everypositive and negative edge of the V_(sense) pulse train. Thisimplementation prevents the presumed time of the zero cross fromdrifting. In addition, in one embodiment, continuous edge detection mustbe done to monitor the line voltage, since the pulse width is used forthat purpose.

An example of edge detection as just described is shown in FIG. 8. Asmay be seen, due to the nature of the optical coupler Al, the sinusoidalwaveform seen on the line voltage is translated to a square wave as seenby the microcontroller edge detect input. With respect to FIG. 8, themicrocontroller 29 detects pulse edges, for example, at t₁ and t₂. InFIG. 8, the period “T” is computed form the previous and current cycle,and the zero cross time is computed for the next cycle (or subsequentcycles), since it is used to turn on a relay at a prescribed timesynchronized with the next zero voltage crossing. Additionally, knowingt₁ and t₂, various other times may be computed. Various illustrativecomputations are:

t ₃ =t ₁+½(t ₂ −t ₁)   (equation 1)

Sinewave Period=T=t ₇ −t ₃   (equation 2)

Zero crossing t ₀ =t ₃ −¼T   (equation 3)

Zero crossing t ₄ =t ₃+¼ T   (equation 4)

Zero crossing t ₅ =t ₄+½T   (equation 5)

Temperature-Relative Load Control—An illustrative control systemembodiment utilizes a single high-capacity power supply to provide powerto the internal electronics of the control system, as well asperipherals connected to RS-485 and I2C busses, such as chlorinegenerators, light systems, audio systems and so forth. Since the spaenvironment is very warm, the temperature may reduce the load capabilityof the power supply. In one embodiment, the microcontroller 29 can beconfigured to respond to these circumstances by a method comprising thefollowing steps:

1) Monitor the temperature inside the control box, in relative proximityto the power supply module. The control box typically contains controlcomponentry such as microprocessors, relays, bus drivers, analoginterfaces and so forth.

2) Monitor the current flowing to the peripherals.

3) If the temperature is at or above one of several thresholds, and thecurrent measured is above the limit for that temperature, send commandsto the various peripherals to force them to power down, thus reducingthe loading.

4) Continue shut downs on peripherals until within range for the powersupply.

The foregoing discussion sets forth logic for implementing controlfunctions which may be implemented in various embodiments. In oneembodiment, such logic may comprise hard wired logic. In otherillustrative embodiments, such logic, as well as other logic discussedherein, is embodied in one or more computer programs or computersoftware, for example, such as an application written in C, assembly, orother suitable programming language. In one embodiment shown in FIG. 2,such software is stored on a computer readable medium or media 23 andmay be executed by a microcontroller 29, which may comprise, forexample, one or more microprocessors, digital processors, centralprocessing unit(s) (CPUs), or other computer(s). In an illustrativeembodiment, the microcontroller 29 may comprise a PIC32 microprocessorwith 512K bytes of flash ROM, suitable amounts of RAM, EEPROM, andadequate I/O peripherals for the various serial port functions, forexample, such as two RS-485 buses, I2C, SPI, etc. Apparatus forexecuting instructions of such computer programs or software maycomprise part of either the spa controller 29 or the control head 31, orboth, in various embodiments.

For the purposes of this disclosure, a computer readable medium storescomputer data, which data can include computer program code that isexecutable by a computer, in machine readable form. By way of example,and not limitation, a computer readable medium may comprise computerreadable storage medium or media, for tangible or fixed storage of data,or communication media for transient interpretation of code-containingsignals. Computer readable storage medium or media, as used herein,refers to physical or tangible storage (as opposed to signals) andincludes without limitation volatile and non-volatile, removable andnon-removable storage media implemented in any method or technology forthe tangible storage of information such as computer-readableinstructions, data structures, program modules or other data. Computerreadable storage media includes, but is not limited to, RAM, ROM, EPROM,EEPROM, flash memory or other solid state memory technology, CD-ROM,DVD, or other optical storage, magnetic cassettes, magnetic tape,magnetic disk storage or other magnetic storage devices, or any otherphysical or material medium which can be used to tangibly store thedesired information or data or instructions and which can be accessed bya computer or processor. In certain embodiments, when suitable computerprogram code is loaded into and executed by a computer, the computerbecomes a specially configured apparatus.

Those skilled in the art will appreciate that various adaptations andmodifications of the just described preferred embodiment can beconfigured without departing from the scope and spirit of the invention.Therefore, it is to be understood that, within the scope of the appendedclaims, the invention may be practiced other than as specificallydescribed herein.

What is claimed is:
 1. Voltage sensing circuitry comprising: a firstdiode connected in series with a current limiting resistance which is inturn connected in series with a Zener diode which is in turn connectedin series with an optical coupler LED; wherein an A.C. input voltage tobe sensed is coupleable across one terminal of said first diode and oneterminal of said optical coupler LED; and wherein the optical couplerLED comprises part of an optical coupler circuit having an output whichprovides a voltage sense signal comprising a pulse train whose pulsewidth is proportional to the A.C. input voltage.
 2. The voltage sensingcircuitry of claim 1 further comprising one or more microcontrollers ormicroprocessors configured to (a) determine the magnitude of the A.C.input voltage from the pulse width of the sensed voltage; (b) determinethe frequency of the A.C. input voltage utilizing the period of thepulse train; and (c) determine a zero cross time of the A.C. inputvoltage waveform.
 3. The voltage sensing circuit of claim 2 wherein thezero crossing time is determined by implementing a timer to determine atimer value each time an edge of a pulse of the A.C. input voltageoccurs.
 4. The voltage sensor of claim 2 wherein the zero cross timeevent is computed by determining the time of occurrence of the middle ofa voltage waveform pulse and then adding or subtracting 25% of thatperiod.
 5. The voltage sensor of claim 2 wherein, to compute the timeoccurrence of a zero voltage crossing, a free running timer is used andthe one or more microcontrollers or microprocessors registers the timervalue when each edge of a pulse occurs, then computes the timer value atthe midpoint of the pulse, and then adds or subtracts 25% of that periodtime value to or from the center time value to establish the timer valuefor a zero crossing.
 6. The voltage sensor of claim 2 wherein themicrocontroller employs an edge sensitive capture input and furtheremploys software to first set the edge sensitive capture input to sensea positive transition of a voltage pulse train, whereafter the nextpositive signal edge of the pulse train causes the value of afree-running hardware timer to be transferred to a latch at the momentof the signal edge and also causes an interrupt to vector themicrocontroller to a software routine which reads the latch value andre-programs the edge sensitive captive input to sense a negative edge ofthe pulse train.
 7. The voltage sensor of claim 5 wherein the sameprocess occurs when a negative edge of the voltage pulse train occurs,such that the microcontroller software produces a string of positive andnegative edge time values.